import {createStore,applyMiddleware,compose} from 'redux';
import reducers from './reducers';
import {persistStore,persistReducer} from 'redux-persist';
import storage from 'redux-persist/lib/storage';
const persistConfig = {
  key:'root'
  ,storage
};

const persistedReducer = persistReducer(persistConfig, reducers); //每当reducer改状态的时候都会往localstorage放一份

const store = createStore(persistedReducer);

const persistor = persistStore(store); //主要是给store混入了一个 initState 方法,该方法会派发一个从storage里初始化本地状态的动作(在PersistGate组件挂载时

export {store, persistor};
export default store;
